<!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    const vm = {
        foo: 'foo',
        bar: 'bar',
        foobar: function () {
            return this.foo + ' ' + this.bar
        },
        test() {
            return this.foo + ' ' + this.bar
        }
    }

    const computedDep = {
        // 依赖项
        foo: {
            // 计算属性
            foobar: {
                getter: vm.foobar,
            },
        }
    }

    const fn = vm.foobar
    // 缓存计算属性的所有依赖项，并在 set 中执行计算属性的方法
    console.log(fn.call(vm));
</script>
</body>
</html>
